package com.soats.demo8.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.soats.demo8.entity.Crimes;
import com.soats.demo8.response.CrimeYearData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectKey;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface crimesMapper extends BaseMapper<Crimes> {

    List<CrimeYearData> selectByYear();

    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="incidentId", before=false, resultType=int.class)
    int insertAndGetKey(Crimes crimes);
}
